#ifndef PROTOCOL103VIEW_H
#define PROTOCOL103VIEW_H

#include "rightwidget.h"

class DialogAddPoint : public QDialog
{
    Q_OBJECT
public:
    DialogAddPoint(const QString& pointType,const QList<quint32>& lstSrc,
                   const QList<quint32>& lstSelected,QWidget* parent=0);
    virtual ~DialogAddPoint();

public:
    void getSelectPoint(QList<quint32>& point){point=m_seclecPoint;}

protected slots:
    virtual void accept();

private:
    QListWidget* m_lwPoint;
    QPushButton* m_pbOk;
    QPushButton* m_pbCancel;

    QList<quint32> m_seclecPoint;
};

class Protocol103View : public RightWidget
{
    Q_OBJECT
public:
    Protocol103View(const QString& path);
    virtual ~Protocol103View();

public:
    virtual bool init();
    virtual bool updateParm();

public slots:
    virtual void deviceChanged();

protected slots:
    void addCpu();
    void removeCpu();
    void setDevice();

    void addPoint();
    void removePoint();
    void pointUp();
    void pointDown();

    void cpuSelectChanged(QTableWidgetItem*, QTableWidgetItem*);

protected:
    void updateListCpu();
    void updateListPoint();
    void updateListDevice();

private:
    QTableWidget* m_twCpu;
    QPushButton* m_pbCpuAdd;
    QPushButton* m_pbCpuRemove;
    QComboBox* m_cbDevice;
    QPushButton* m_pbSetDeice;

    QTabWidget* m_tabPoint;

    QTableWidget* m_twAi;
    QTableWidget* m_twDi;
    QTableWidget* m_twPi;
    QTableWidget* m_twDo;
    QTableWidget* m_twAction;
    QTableWidget* m_twAlarm;

    QPushButton* m_pbPointAdd;
    QPushButton* m_pbPointRemove;
    QPushButton* m_pbPointUp;
    QPushButton* m_pbPointDown;

//    QMap<quint32,Hy103Cpu*> m_cpu;

    quint32 m_maxCpuId;
};

#endif // PROTOCOL103VIEW_H
